package com.example.day17;

/**
 * @author Lenovo
 */
public class DiGuiDemo01 {
    public static void main(String[] args) {
        int sum = getSum(5);
        System.out.println(sum);
    }
    public static int getSum(int n) {
        if (n == 1) {
            return 1;
        } else {
            return n + getSum(n - 1);
        }
    }
}
